home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2077 < prev    next >
Encoding:
Text File  |  1996-08-06  |  3.4 KB  |  89 lines

  1. Path: arlut.utexas.edu!usenet
  2. From: Lee Crites <crites>
  3. Newsgroups: comp.lang.c++
  4. Subject: Problems with STL compiling...
  5. Date: 15 Jan 1996 19:46:31 GMT
  6. Organization: Applied Research Laboratories - The University of Texas at Austin
  7. Message-ID: <4deaun$o94@ns1.arlut.utexas.edu>
  8. NNTP-Posting-Host: squid.arlut.utexas.edu
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 1.1N (X11; I; HP-UX A.09.01 9000/730)
  13. X-URL: news:comp.lang.c++
  14.  
  15. I'm just trying my first compile of programs using the STL.  I'm using an
  16. example program from Nelson's book _C++_Programmer's_Guide_to_the_STL.  I
  17. started with the latest version of the stl straight from hp, and then started
  18. testing witht the version included with the book.  My results were identicle
  19. either way.
  20.  
  21. For those with the book, I'm trying to get the first program to compile,
  22. VECT0401.CPP.  (I've gone through and changed all of the uppercase include
  23. names to lower case, but that's the only change made to his originals)
  24.  
  25. I'm having problems with vector.h.  Here are the lines in question:
  26.  
  27. from vector.h:
  28.  
  29. template <class T>
  30. class vector {
  31. public:
  32.  
  33.     typedef Allocator<T> vector_allocator;
  34.     typedef T value_type;
  35.     typedef vector_allocator::pointer pointer;  // this is line 38
  36.     typedef vector_allocator::pointer iterator;
  37.     typedef vector_allocator::const_pointer const_iterator;
  38.     typedef vector_allocator::reference reference;
  39.     typedef vector_allocator::const_reference const_reference;
  40.     typedef vector_allocator::size_type size_type;
  41.     typedef vector_allocator::difference_type difference_type;
  42.     typedef reverse_iterator<const_iterator, value_type, const_reference,
  43.                              difference_type>  const_reverse_iterator;
  44.     typedef reverse_iterator<iterator, value_type, reference, difference_type>
  45.         reverse_iterator;
  46. ..
  47. ..
  48.  
  49.  
  50. The error messages:
  51.  
  52. /opt/bin/CC -g +w -I/usr/include -Iinclude -I. -I/usr/stl/include -o vect0401
  53. vect0401.cpp
  54. "/usr/stl/include/defalloc.h", line 26: Warning (Anachronism): operator
  55. new(unsigned, void*) was previously declared "extern", not "inline".
  56. "/usr/stl/include/defalloc.h", line 26: Note: Type "CC -migration" for more on
  57. anachronisms.
  58. "/usr/stl/include/vector.h", line 38: Warning: A qualifier is not allowed for
  59. pointer.
  60. "vect0401.cpp", line 34:     Where: While specializing vector<double>.
  61. "vect0401.cpp", line 34:     Where: Specialized in non-template code.
  62. "/usr/stl/include/vector.h", line 38: Error: "," expected instead of "pointer".
  63. "vect0401.cpp", line 34:     Where: While specializing vector<double>.
  64. "vect0401.cpp", line 34:     Where: Specialized in non-template code.
  65. "/usr/stl/include/vector.h", line 39: Error: Use ";" to terminate declarations.
  66. "vect0401.cpp", line 34:     Where: While specializing vector<double>.
  67. "vect0401.cpp", line 34:     Where: Specialized in non-template code.
  68. 2 Error(s) and 2 Warning(s) detected.
  69. *** Error code 2
  70.  
  71. Other stuff:
  72.  
  73. running on a Sun, using SunOs5.4
  74.  
  75. changing the pointer to something else (like va_pointer) only changes the text
  76. in the error messages.  (thinking that the string 'pointer' was used someplace
  77. else and that was the problem)
  78.  
  79. I can send full source code if anyone needs it.
  80.  
  81. So my main question is this:  what do I need to do to fix this?  Is there
  82. something wrong with my compiler (everyone else can compile with without
  83. changes?!?) or am I missing something (like an obscure include file)?
  84.  
  85. Any help would be appreciated...
  86.  
  87. Lee
  88.  
  89.